home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-01-31 | 1.4 KB | 50 lines | [TEXT/MPS ] |
- C SetVolume.f is an example of how to use SetVolume
- C and other Language System functions to manipulate
- C which folder datafiles are written to.
-
- C Example provided for owners of Language Systems FORTRAN
- C © 1992 Language Systems Corp.
-
- program SetVolume
- integer*4 VolumeRef(2),OldRef
- c
- write(*,*) ' F_SetVolume() Demo'
- write(*,*)
-
- c remember the current directory
- OldRef = JVRefnum(int4(-1))
-
- c choose a file somewhere, record its directory
- call alertBox('Please choose an existing file.')
- open(10,file=*,status='old',err=900)
- VolumeRef(1) = JVRefnum(int4(10))
-
- c choose a destination, record its directory
- call alertBox('Now specify the location of a new file.')
- open(20,file=*'File to be created:',status='new',err=900)
- VolumeRef(2) = JVRefnum(int4(20))
- c
- c Now we have reference numbers for all 3 directories
- c
- c Set the directory to the folder where unit 10 lives
- c and create a new file there.
- call F_SetVolume(VolumeRef(1))
- open(15,file='new1',status='new')
- write(15,*) 'hello'
- c
- c Set the directory to the folder where unit 20 lives
- c and create a new file there.
- call F_SetVolume(VolumeRef(2))
- open(25,file='new2',status='new')
- write(25,*) 'hello'
- c
- c Set the directory back to the folder where this program lives
- c and create a new file there.
- call F_SetVolume(OldRef)
- open(35,file='new3',status='new')
- write(35,*) 'hello'
-
- ! FORTRAN will close all files
- 900 continue
- end
-